package com.javatest.springboot.mapper;

import com.javatest.springboot.entities.Department;
import org.apache.ibatis.annotations.*;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/1/5 14:50
 */
//指定这是一个操作数据库的mapper
//@Mapper
public interface DepartmentMapper {
    @Select("select * from department where id=#{id}")
    Department getDeptById(Integer id);

    @Delete("delete from department where id=#{id}")
    int deleteDeptById(Integer id);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into department(departmentName) values (#{departmentName})")
    int insertDept(Department department);

    @Update("update department set departmentName=#{departmentName} where id=#{id}")
    int updateDept(Department department);
}
